
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>后台</title>
<link rel="stylesheet" href="public/admin/style.css">
<link rel="stylesheet" href="public/admin/dashicons.css">
<script src="public/admin/jquery.min.js"></script>
</head>
<body>
<div class="wrap wrap-course-edit">
<h1>课程管理</h1>
<div class="tab">
	<a href="admin-course-edit.html" class="">课程信息</a>
	<a href="admin-video-edit.html" class="curr">配置视频</a>
	<a href="admin-question-edit.html" class="">配置习题</a>
</div><div class="tips"></div>
<div class="box">
<div class="box-title">配置视频</div>
<div class="box-body">
<form method="post" action="/?p=admin&c=video&a=edit&id=3&token=c15a2f6833d839516c2d95b4ce48456b">
	<table class="v-table">
		<tr><th width="84">删除</th><th width="40">试看</th><th width="84">排序</th><th>视频名称</th><th>视频地址</th></tr>
				<tr class="hover">
			<td><input type="checkbox" class="jq-del" name="del[]" value="1"></td>
			<td><input type="checkbox" name="save[1][trial]" value="yes" ></td>
			<td><input type="text" class="v-num" name="save[1][sort]" value="0"></td>
			<td><input type="text" name="save[1][title]" value="Linux网络流媒体服务器-课程1" required></td>
			<td><input type="text" class="v-url" name="save[1][url]" value="./video/test.mp4" required></td>
		</tr>
				<tr class="hover">
			<td><input type="checkbox" class="jq-del" name="del[]" value="2"></td>
			<td><input type="checkbox" name="save[2][trial]" value="yes" ></td>
			<td><input type="text" class="v-num" name="save[2][sort]" value="0"></td>
			<td><input type="text" name="save[2][title]" value="Linux网络流媒体服务器-课程2" required></td>
			<td><input type="text" class="v-url" name="save[2][url]" value="./video/test.mp4" required></td>
		</tr>
				<tr class="hover">
			<td><input type="checkbox" class="jq-del" name="del[]" value="3"></td>
			<td><input type="checkbox" name="save[3][trial]" value="yes" ></td>
			<td><input type="text" class="v-num" name="save[3][sort]" value="0"></td>
			<td><input type="text" name="save[3][title]" value="Linux网络流媒体服务器-课程3" required></td>
			<td><input type="text" class="v-url" name="save[3][url]" value="./video/test.mp4" required></td>
		</tr>
				<tr class="hover">
			<td><input type="checkbox" class="jq-del" name="del[]" value="4"></td>
			<td><input type="checkbox" name="save[4][trial]" value="yes" ></td>
			<td><input type="text" class="v-num" name="save[4][sort]" value="0"></td>
			<td><input type="text" name="save[4][title]" value="Linux网络流媒体服务器-课程4" required></td>
			<td><input type="text" class="v-url" name="save[4][url]" value="./video/test.mp4" required></td>
		</tr>
				<tr><td colspan="5" class="left"><span class="jq-add s-add"><i class="icon-cross"></i><b>添加视频</b></span></td></tr>
	</table>
	<input type="submit" value="保存修改">
</form>
<script>
	//添加视频
	var add_id = 0; //新增ID计数
	$(".jq-add").click(function(){
		$(this).parents("tr").before('<tr class="hover"><td><b class="jq-cancel">删除</b></td>\
		<td><input type="checkbox" name="add['+ add_id +'][trial]" value="yes"></td>\
		<td><input type="text" class="v-num" name="add['+ add_id +'][sort]"></td>\
		<td><input type="text" name="add['+ add_id +'][title]" required></td>\
		<td><input type="text" class="v-url" name="add['+ add_id +'][url]" required></td></tr>');
		++add_id;
	});
	//取消添加
	$(document).on("click",".jq-cancel",function(){
		$(this).parents("tr").remove();
	});
	//勾选删除
	$(".jq-del").click(function(){
		var text = $(this).parents("tr").find("td input[type=text]");
		if($(this).is(":checked")){
			text.attr("disabled", "disabled");
		}else{
			text.removeAttr("disabled");
		}
	});
</script>
</div>
</div>
</div>
</body>
</html>